package com.onlyphoto.onlymall.mvp.view.activity

import android.graphics.Bitmap
import android.os.Build
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import androidx.core.content.ContextCompat
import com.onlyphoto.onlymall.R
import kotlinx.android.synthetic.main.activity_qrcode.*
import qiu.niorgai.StatusBarCompat

class QRCodeActivity : AppCompatActivity() {

    var bitmap: Bitmap?  = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_qrcode)
        init()
    }

    private fun init(){
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            StatusBarCompat.setStatusBarColor(this, ContextCompat.getColor(this, R.color.white))
            this.window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
        }

        bitmap = intent.getParcelableExtra("bitmap")
        if (bitmap != null) {
            qr_code.setImageBitmap(bitmap)
        }

        back.setOnClickListener{
            finish()
        }
    }
}
